package com.comp.service.impl;

import com.comp.dao.jdbc.AddressbookMapper;
import com.comp.pojo.Addressbook;
import com.comp.service.AddressBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressBookServiceImpl implements AddressBookService {

    @Autowired
    private AddressbookMapper addressbookMapper;

    @Override
    public List queryList() {
        return addressbookMapper.selectByExample(null);
    }

    @Override
    public int insertAddress(Addressbook addressbook) {
        return addressbookMapper.insertSelective(addressbook);
    }

    @Override
    public Addressbook queryById(Integer id) {
        return addressbookMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateAddress(Addressbook addressbook) {
        return addressbookMapper.updateByPrimaryKeySelective(addressbook);
    }

    @Override
    public int deleteAddress(Integer id) {
        return addressbookMapper.deleteByPrimaryKey(id);
    }
}
